<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>锅炉虚拟仿真考试系统-后台-登录</title>

    <link rel="shortcut icon" href="../../common/images/favicon.ico" />
    <!-- Bootstrap -->
    <link href="/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="/bootstrap/dist/css/bootstrap-theme.min.css" rel="stylesheet">

	<link href="css/plugins/toastr/toastr.min.css" rel="stylesheet">
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

	<style>
		.divcss5{  width:1280px; height:700px;text-align:center}
		.divcss5 img{width:1280px; height:700px;text-align:center}
	</style>

</head>
<body class="login">


<div class="divcss5" ng-app="myApp" ng-controller="myCtrl">


	<div id="container" >
		<section class="login-box" >
			<form class="login-form" method="post" >

				<div class="login-form-top" >
					<div class="email-wrap">
						<span class="glyphicon glyphicon-user" aria-hidden="true"><input id="userName" class="login-form-input" ng-model="name"/></span>
					</div>
					<div class="psw-wrap">
						<span class="glyphicon glyphicon-lock" aria-hidden="true"><input id="password" type="password" class="login-form-input" ng-model="psw"/></span>
					</div>
					<a class="btn btn-blue" id="logIn" ng-click="login()" role="button">登录</a>
				</div>
			</form>
		</section>
	</div>
</div>

</body>
<script type="text/javascript" src="/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="/angular/angular.min.js"></script>
<script type="text/javascript" src="/js/plugins/toastr/toastr.js"></script>
<script>
	toastr.options = {
		"closeButton": true,
		"debug": false,
		"progressBar": true,
		"positionClass": "toast-top-right",
		"onclick": null,
		"showDuration": "400",
		"hideDuration": "1000",
		"timeOut": "7000",
		"extendedTimeOut": "1000",
		"showEasing": "swing",
		"hideEasing": "linear",
		"showMethod": "fadeIn",
		"hideMethod": "fadeOut"
	};
</script>
<script>

	var app = angular.module("myApp", []);

	app.controller("myCtrl", function($scope) {
		$scope.firstName = "John";
		$scope.lastName = "Doe";
		$scope.login = function () {
			var data={
				'user' : $scope.name,
				'password' : $scope.psw
			};
			$.ajax({
				method : 'post',
				url : '/login',
				data:data,
				success:function(resp){
					var data2 = resp.data;
					console.log(data2);
					if(resp.code === "0" || resp.code === 0 ){
						window.location.href="../home";
					}
					else
					{
						toastr.error('请输入正确的用户名和密码', '系统消息');
					}
				},
				error:function(resp){
					/* Act on the event */
					console.log('aa');
				}
			});
		//	console.log(data);

		}
	});

</script>

</html>